/**
 * 
 */
package org.kang.myhadoop;

import java.io.IOException;
import java.util.Iterator;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;

/**
 * 
 * @author yanglk <br>
 *         <a href="mailto:yanglk2010@sina.com">yanglk2010@sina.com</a>
 * @Time 2017年6月7日 下午4:03:13
 * @since 1.0
 * @version 1.0
 */
public class ReducerClass extends Reducer<Text, IntWritable, Text, IntWritable>{

	@Override
	public void reduce(Text key, Iterable<IntWritable> values, Context context) throws IOException, InterruptedException{
		int sum = 0;
		Iterator<IntWritable> valuesIt = values.iterator();
		while(valuesIt.hasNext()){
			sum += valuesIt.next().get();
		}
		context.write(key, new IntWritable(sum));
	}
}
